package com.mc.algorithm;

public class RotateArray {
	public static int search(int[] array){
		int i = 0;
		int j = array.length-1;
		while(j-i!=1){
			int mid = (i+j)/2;
			if(array[mid]>array[i])
				i = mid;
			else if(array[mid]<array[i])
				j = mid;		
		}
		return array[j];
		
	}
	public static void main(String[] args) {
		int[] array = new int[]{3,4,5,1,2};
		int result = RotateArray.search(array);
		System.out.println(result);
	}
}
